/****************************************************
          File Name:header.h
          Author: Abby Cin
          Mail: abbytsing@gmail.com
          Created Time: Mon 10 Nov 2014 09:33:39 AM CST
*****************************************************/

#ifndef header_h_
#define header_h_

#include <assert.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/time.h>
#include <malloc.h>
#include <string.h>
#include <asm/types.h>
#include <linux/videodev2.h>


#define CLEAN(x)	memset(&x, 0, sizeof(x))

static int fd = -1; 	/* because 0, 1, 2 already occupied by standard in/out/err */
static char *device = "/dev/video0";
static unsigned int n_buffers;

void dev_open(void);

void dev_close(void);

void dev_init(void);

void start_capture(void);

void stop_capture(void);

void capture_time(unsigned int count, FILE *fp);

void dev_uninit(void);


#endif

